package myJs.myPkg.ztree

import argonaut.Json
import myJs.Utils.g
import myJs.myPkg.jquery.{$, JQuery}

import scala.scalajs.js

/**
 * Created by yz on 10/3/2020
 */

object Ztree {

  def init(jq: JQuery, setting: js.Any, zNodes: js.Any): Dynamic = {
    g.$.fn.zTree.init(jq, setting, zNodes)
  }

  def init(jq: JQuery, setting: js.Any) = {
    g.$.fn.zTree.init(jq, setting)
  }

  def getZTreeObj(treeId: String): ZTreeObj = {
    g.$.fn.zTree.getZTreeObj(treeId).asInstanceOf[ZTreeObj]
  }

}

@js.native
trait ZTreeObj extends js.Object {

  def getSelectedNodes(): js.Array[js.Dictionary[String]] = js.native

  def getNodes(): js.Array[js.Dictionary[String]] = js.native

  def transformToArray(treeNodes: js.Array[js.Dictionary[String]]): js.Array[js.Dictionary[String]] = js.native

  def selectNode(treeNode: js.Dictionary[String]): Unit = js.native

  def cancelSelectedNode(): Unit = js.native

  def updateNode(treeNode: js.Dictionary[String]): Unit = js.native

  def reAsyncChildNodes(parentNode: js.Dictionary[String], reloadType: String, isSilent: Boolean): Unit = js.native


}
